package com.smart.service.impl;

import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.smart.entity.ViolationRecords;
import com.smart.mapper.ViolationRecordsMapper;
import com.smart.service.IViolationRecordsService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;


/**
 * <p>
 * 记录违规情况的表 服务实现类
 * </p>
 *
 * @author Cookies
 * @since 2024-05-13
 */
@Service
public class ViolationRecordsServiceImpl extends ServiceImpl<ViolationRecordsMapper, ViolationRecords> implements IViolationRecordsService {
    @Override
    public IPage getViolationRecordsList(Integer current, Integer size, String violatorUid) {
        IPage page = new Page(current, size);
        return lambdaQuery()
                .eq(StrUtil.isNotBlank(violatorUid), ViolationRecords::getViolatorUid, violatorUid)
                .orderByDesc(ViolationRecords::getId)
                .page(page);
    }
}
